package tech.aistar.controller;


import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tech.aistar.mapper.AttractionMapper;
import tech.aistar.pojo.Attraction;
import tech.aistar.pojo.ResultReturn;
import tech.aistar.service.AttractionService;

import java.util.List;

@RestController
@RequestMapping("/attraction")
public class AttractionController {

    @Autowired
    private AttractionService attractionService;

    @GetMapping
    public ResultReturn index(@RequestParam("Location") String Location, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "20") Integer pageSize){
        PageInfo<Attraction> pageInfo = attractionService.pageInfo(Location,pageNum,pageSize);
        return ResultReturn.success(pageInfo);
    }

    @GetMapping("/info")
    public ResultReturn info(){
        System.out.println("gong");
        List<Attraction> list = attractionService.getAll();
        return ResultReturn.success(list);
    }

}
